package com.gushuang.oj.judge.codesandbox.impl;

import com.gushuang.oj.judge.codesandbox.CodeSandbox;
import com.gushuang.oj.judge.codesandbox.model.ExcuteCodeRequest;
import com.gushuang.oj.judge.codesandbox.model.ExcuteCodeResponse;
import com.gushuang.oj.model.dto.question.JudgeInfo;
import com.gushuang.oj.model.enums.JudgeInfoMessageEnum;
import com.gushuang.oj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * @author 孤霜
 * @version 1.0
 */

/**
 * 示例代码沙箱
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExcuteCodeResponse executeCode(ExcuteCodeRequest excuteCodeRequest) {
        List<String> inputList = excuteCodeRequest.getInputList();
        ExcuteCodeResponse excuteCodeResponse = new ExcuteCodeResponse();
        excuteCodeResponse.setOutputList(inputList);
        excuteCodeResponse.setMessage("测试执行成功");
        excuteCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        excuteCodeResponse.setJudgeInfo(judgeInfo);
        return excuteCodeResponse;
    }
}
